The fcSDK is "time zone aware" and can automatically convert date and time values into various time zones for you. In this mode, all time zones that you see (in your generic objects) are in the local time zone. The fcSDK automatically converts all date/time fields so that they are written to the database in the server's time zone. This way, different clients in different parts of the country (or world) will all write consistent date/times to the database. When you retrieve data via the fcSDK, all of the date/time fields will be converted to your local time zone, so that it appears correct to the application user.
Setting up time zone conversion is easy. There are three steps necessary for the fcSDK to display dates and times in the correct time zone for users using different time zones:
ClarifyApplication.ConvertTimeZone Property
ClarifySession has a property: ConvertTimeZone. If this property is set to "true" (which is the default), the fcSDK will perform time zone conversions for you any time date values are read from or stored to a ClarifyGeneric instance.
ClarifyApplication.ServerTimeZone
Represents the time zone the server will use for time zone conversion operations. By default the database default time zone will be used.
The default ServerTimeZone can be changed by updating the time_zone record and refreshing the application cache:
If you wish override the ServerTimeZone it is recommended that you do so before creating any ClarifySession objects.
ClarifySession.LocalTimeZone
When using the fcSDK, your application can specify on each session which time zone the user is in (usually this is done on the login form/web page). Simply set the LocalTimeZone property on the session to the appropriate time zone and date values will get converted according to the setting in the ConvertTimeZone property.
The date/time conversion handles all aspects of the fcSDK. For example, you can use the "NOW" date/time constant (ClarifyGeneric.NOW_DATE), and it will be converted properly. In addition, if you modify a "Change Field", the "Change Date" field will also be updated to the database properly converted.
For example, the following C# and Visual Basic.NET code illustrates the process.
[C#]
// Create and initialize the ClarifyApplication instance |
[Visual Basic]
' Create an initialize the ClarifyApplication instance |